package com.sgb.goods.widget.pop;

import android.content.Context;
import android.view.View;

import com.sgb.goods.entity.PayDetailEntity;
import com.sgb.goods.utils.base.adapter.BaseCommonAdapter;
import com.sgb.goods.widget.pop.adapter.PaymentDetailsAdapter;
import com.swgk.core.dialog.PopViewHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * 付款详情弹窗
 *
 * @author cyj
 */
public class PaymentDetailsPop extends SimpleTile1Pop<PayDetailEntity> {

    public PaymentDetailsPop(Context context) {
        super(context);
    }

    private PaymentDetailsAdapter adapter;

    @Override
    protected BaseCommonAdapter<PayDetailEntity> getAdapter() {
        return null == adapter ? adapter = new PaymentDetailsAdapter() : adapter;
    }

    @Override
    protected void initView(PopViewHolder holder) {
        super.initView(holder);
        mTitle.setText("付款详情");
    }

    public void showPop(View view, PayDetailEntity entity, boolean isSellOrder) {
        if (null != adapter) {
            adapter.setShowProof(isSellOrder);
        }
        mTitle.setText(isSellOrder ? "收款详情" : "付款详情");
        List<PayDetailEntity> list = new ArrayList<>();
        list.add(entity);
        adapter.setNewData(list);
        super.showDownPopwindow(view, true);
    }

}
